package com.mice.controller{
	import com.iyimo.core.mvc.Controller;
	import com.mice.command.Cmd100;
	import com.mice.command.bean.UserBean;
	import com.mice.constant.NotifyConst;
	import com.mice.game.GameEngine;
	import com.mice.game.core.Player;
	import com.mice.model.AppVO;
	import com.mice.model.user.UserVO;
	
	public class InitialController extends Controller{
		public static const NAME:String = "InitialController";
		
		public function InitialController(){
			super();
		}
		
		override public function onRegister():void{
			var cmd:Cmd100 = new Cmd100();
			cmd.addListener(onCmd100);
			cmd.execute();
		}
		
		private function onCmd100(bean:UserBean):void{
			var player:Player = new Player();
			player.team = Player.TEAM_RED;
			player.energyRecoverInternal = 120;
			GameEngine.instance.player = player;
			
			player = new Player();
			player.team = Player.TEAM_BLUE;
			player.energyRecoverInternal = 120;
			GameEngine.instance.ai = player;
			
			AppVO.hostUser = new UserVO();
			AppVO.hostUser.level = bean.level;
			AppVO.hostUser.name = bean.name;
			AppVO.hostUser.player =GameEngine.instance.player;
			
			sendNotification(NotifyConst.NOTIFY_INIT_COMPLETE);
		}
	}
}